<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
</head>
<body>

    <h1>
        Quick Start</h1>
    <p>
        1. Install CIPl
    </p>
    <p>
        2. Create a command line app in Visual Studio called CIPlQuickStart</p>
    <p>
        3. Add CIP4.Core.dll and CIP4.Simple.dll to the project&#39;s references section</p>
    <p>
        4. Replace the content of the Program.cs with the following text:</p>
    <pre>
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CIP4.Common;
using CIP4.Item;
using CIP4.Simple;


namespace CIPlQuickStart
{
    class Program
    {
        static void Main(string[] args)
        {
            PersonType p = new PersonType
            {
                Name = "foo",
                Address = new AddressType
                {
                    Street = " bar 1",
                    City = "Gonzoville",
                    Zip = 12345
                }
            };

            Directory.CreateDirectory("c:\\temp\\PeopleData");

            PersonType.Wrapper.SaveItems(new List<PersonType> { p });

            PersonType pp = PersonType.Wrapper.GetViaExternalID(new ExternalIDType("foo"));

            Console.WriteLine(PersonType.Wrapper.GetXmlForObject(pp));

        }
    }

    [CIP4Item(AddAllProperties=true, Collection="People"),
        CIP4FileConnection(BaseDirectoryPath = "c:\\temp\\PeopleData")]
    public class PersonType
    {
        public static StrongWrapper<PersonType> Wrapper = new StrongWrapper<PersonType>(Globals.DefaultLogger);
        [CIP4ExternalID]
        public string Name { get; set; }
        public AddressType Address { get; set; }
    }

    [CIP4Item(AddAllProperties = true)]
    public class AddressType
    {
        public string Street { get; set; }
        public string City { get; set; }
        public int Zip { get; set; }
    }
}

        </pre>

    <p>
        When you run the app you should see something like the following:</p>

<pre>
17:50:44 Trace.InitializingProvider - Initalizing Provider: BaseDirectoryPath=c:\temp\PeopleData
17:50:44 Trace.LoadedProvider - Loaded provider BaseDirectoryPath=c:\temp\PeopleData
17:50:44 Warning.SpontaneousSerializer - Serializer for C:\Users\patrick.thompson\Documents\Visual Studio 2008\Projects\CIPlQuickStart\CIPlQuickStart\bin\Debug\
CIPlQuickStart.exe seems to be out of date - attempting to build a new one - watch for fireworks
17:50:44 Trace.Generic - Serializer generated for PersonType, AddressType
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; tedious details omitted &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
17:50:44 Trace.Generic - Finished compiling \CIPlQuickStart\bin\Debug\CIPlQuickStart_CIP4XmlSerializer.dll
17:50:44 Trace.ActionStart - Started SaveItems
17:50:44 Trace.ItemsUpdated - Items foo updated
17:50:44 Information.SaveItems - 1 items saved in People
17:50:44 Trace.ActionStart - Started GetItems
17:50:44 Information.GetItems - Get 1 items from People
&lt;Item xmlns="http://channelintelligence.com/CIPlItem1.xsd"&gt;&lt;Valid&gt;1&lt;/Valid&gt;
&lt;ItemStatus&gt;100&lt;/ItemStatus&gt;&lt;ExternalID&gt;foo&lt;/ExternalID&gt;&lt;ModifiedDate&gt;2010-10-03T17:50:44.8251919-07:00&lt;/ModifiedDate&gt;
&lt;PersonType xmlns="http://channelintelligence.com/CIPlOther1.xsd"&gt;
&lt;Address&gt;&lt;AddressType&gt;&lt;City&gt;&lt;String&gt;Gonzoville&lt;/String&gt;&lt;/City&gt;
&lt;Street&gt;&lt;String&gt; bar 1&lt;/String&gt;&lt;/Street&gt;&lt;Zip&gt;&lt;Int32&gt;12345&lt;/Int32&gt;&lt;/Zip&gt;&lt;/AddressType&gt;&lt;/Address&gt;
&lt;Name&gt;&lt;String&gt;foo&lt;/String&gt;&lt;/Name&gt;&lt;/PersonType&gt;&lt;/Item&gt;

</pre>
    <p>
        When you run the app for the first time, CIP4 will generate the serializer
        needed by the app - hence the compile, the text provided from &quot;Trace.ActionStart - Started SaveItems&quot;
        onwards reflects the normal operation of the program.
    </p>
    <h2>
        Quck Start Exensions</h2>
    <p>
        Delete any existing addresses when the application first runs</p>
    <pre><p style="margin-left: 40px">PersonType.Wrapper.DeleteCollection(); </p></pre>
    <p>
        Add a List of alternate Addresses to PersonType - for example
    </p>
    <pre><p style="margin-left: 40px">public List<AddressType> AlternateAddresses { get; set; } </p></pre>
    <p>
        Make AddressType a supertype of USAddress and EUAddress, where the former has
        zip and the latter has PostCode/p>
    <p>
        Store the People collection in another type of data store. For example:</p>
    <pre><p style="margin-left: 40px">[CIP4Item(AddAllProperties=true, Collection=&quot;People&quot;),
CIP4DictionaryConnection(BaseDirectoryPath = &quot;c:\\temp\\PeopleData&quot;)]
public class PersonType </p></pre>
    <p>
        You can run the CIP4.Installer to establish new types of data store such as
        MongoDB, Cassandra, various flavors of Sql or cloud stores such as Mosso or S3.
        The CIP4Installer will guide you through the parameters requried for each of the
        DataProvider types and will providfe the parameters you need for the
        CIP4XXXConnectionAttribute object.</p>
    <p>
        Note that in practice, you will usually provide connection information as a part
        of the execution of the application, not hardwired in a class declaration. CIP4
        provides several mechanisms for doing this that are described in the section on
        <a href="ConnectionHandling.htm">Connection Handling</a>.</p>
    <p>
        &nbsp;</p>

</body>
</html>
